<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .employee .employee_left,.employee_right{width: 50%;float:left;}
    .select2-container .select2-choice > .select2-chosen{text-align: center;}
</style>
</head>
<body>
<include file="Public/common_header" />

<div class="mian">
    <include file="Public/sidebar" menu='xtgl.gysgl' />
    <div class="mianR">
        <h3 class='cha'>集团管理-添加集团</h3>
        <div class="broker">
            <h4>集团信息</h4>
            <ul class="clearfix">
                <li><span><i>*</i>集团名称：</span><input type="text" name="b_name" id="b_name" value="" /></li>
                <li><span><i>*</i>联系人：</span><input type="text" name="contact" id="contact" value="" /></li>
                <li><span><i>*</i>所属分公司：</span>
                    <select class="broker-city" name="branch_id" id="branch_id" >
                        <option value="0">请选择分公司</option>
                        <foreach name="bc_list" item="val" key="key" >
                            <option value="{$key}">{$val}</option>
                        </foreach>
                    </select>
                </li>
                <li><span><i>*</i>联系电话：</span><input type="text" value="" name="phone" id="phone" /></li>
                <li><span>集团地址：</span><input type="text" value="" name="addr" id="addr" /></li>
            </ul>
        </div>
        <div class="yongBtn clearfix">
            <input type="submit" value="提交" class="queding">
            <input class="quxiao" type="submit" value="返回" onclick="location.href = '/SupplierManage/index/status/3'">
        </div>
    </div>
</div>
<script>
    $(".queding").click(function(){
        var b_name = $("#b_name").val();
        if (b_name =='') {
            shibai_alert1('请填写集团名称');
            return;
        };
        var contact = $("#contact").val();
        if (contact =='') {
            shibai_alert1('请填写联系人');
            return;
        };
        var phone = $("#phone").val();
        if (phone =='') {
            shibai_alert1('请填写联系电话');
            return;
        };
        var branch_id = $("#branch_id").find("option:selected").val();
        if (branch_id < 1) {
            shibai_alert1('请选择分公司');
            return;
        };
        var addr = $("#addr").val();
         var param = {
            'b_name':b_name,
            'contact':contact,
            'phone':phone,
            'addr':addr,
            'branch_id':branch_id
        };
        $(".queding").attr("disabled","disabled");
        $.post("/SupplierManage/addBlocPost",param,function(data){
            if(data.code!=200){
                shibai_alert(data.msg,2000)
                $(".queding").removeAttr("disabled").removeAttr("style");
            }else{
                btn_alert("添加成功",1500,function(){
                location.href = '/SupplierManage/index/status/3';
            })
            }
        },"json");
    });
</script>
<include file="Public/foot" />